package com.example.aliyun.plus;

/**
 * 设置和获取Thread 名称
 */
class ThreadName implements Runnable {

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName());
    }
}
public class GetSetThreadName {
    public static void main(String[] args) {
        ThreadName threadName = new ThreadName();
        new Thread(threadName, "线程A").start();
        new Thread(threadName, "线程B").start();
        new Thread(threadName).start();
        new Thread(threadName).start();
        new Thread(threadName).start();
        new Thread(threadName).start();
        new Thread(threadName).start();
    }
}
